@import 'scss-imports/variables';

:host {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  flex: 1;
  font-weight: 500;
  min-height: 44px;
  padding: 0;
}

.tree-node-grid {
  align-items: center;
  background-color: var(--bg2);
  display: grid;
  grid-gap: 8px;
  grid-template-columns: auto 125px 125px 125px;
  min-width: fit-content;
  width: 100%;

  @media (max-width: $breakpoint-tablet) {
    grid-template-columns: auto 0 0 0;
    width: 100%;
  }

  .cell {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    min-height: 44px;

    @media (max-width: $breakpoint-tablet) {
      display: none;
    }

    &:first-child {
      align-items: center;
      left: 15px;
      position: sticky;

      @media (max-width: $breakpoint-tablet) {
        display: inline-flex;
      }
    }
  }

  .cell {
    background: linear-gradient(90deg, var(--bg2) 0%, var(--bg2) calc(100% - 11px), transparent 100%);
    // margin: 0 0 0 -10px;
    // padding: 0 0 0 10px;
    z-index: 1;
  }

  .cell-used-content span {
    white-space: nowrap;
  }
}

// TODO: Fragile (at least with css selectors)
:host-context(ix-tree-node:hover),
:host-context(ix-tree-node.selected),
:host-context(.dataset-nested-tree-root-node:hover),
:host-context(.dataset-nested-tree-root-node.selected) {
  .tree-node-grid {
    background-color: var(--hover-bg);
  }

  .tree-node-grid .cell,
  .tree-node-grid .cell-name .name {
    background: linear-gradient(90deg, var(--hover-bg) 99%, var(--hover-bg) calc(100% - 11px), transparent 100%);
  }

  .tree-node-grid .cell-name .icon-container {
    background-color: var(--hover-bg);
  }
}
